Image processing apparatus

ABSTRACT

Black pixels of image signals are expanded, a plurality of black pixel regions obtained by expanding the black pixels are connected to each other, and the circumscribing rectangles of the connected regions are extracted. In accordance with characteristics of the positions and sizes of the extracted circumscribing rectangles and the direction of characters in the circumscribing rectangles, whether the direction of the image is longitudinal or lateral and whether the image faces upwards or downwards are determined. In accordance with a result of the determination, configuration of the plural original document images on a sheet is decided. The plural original documents are combined into one composite image with the decided configuration. Therefore, a required copy output can be obtained regardless of the direction of the original document employed by a user and the direction of the original document set by the same.

This application is a continuation, of application Ser. No. 08/800,508,filed Feb. 14, 1997 now U.S. Pat. No. 6,084,988.

BACKGROUND OF THE INVENTION

The present invention relates to an image processing apparatus foroutputting copied images such that a plurality of original documentsheets are recorded on either side of sheets by an OA (OfficeAutomation) apparatuses, such as copying machines, or on both sides ofone sheet.

In offices in recent years, PC (Personal Computers) and printers havebeen used widely and thus copied documents and paper documents have beenincreased.

On the other hand, attempts have been made to reduce the quantity ofpaper to solve one environmental problem, thus resulting in thatregenerated paper and reverse sides of paper sheets being used andcontrivance of contracting images of a plurality of original documentsheets to combine and output the images onto one sheet being performed.Copying machines developed recently have a function of contractingimages of a plurality of original document sheets to combine and outputthe images onto one sheet.

However, the conventional copying machines, having the function capableof contracting images of a plurality of original document sheets tocombine and output the images onto one sheet, involve an unintentionalfact that images cannot be formed in a required sequential orderattributable to the direction of the original document whether thedirection is longitudinal or lateral (landscape/portrait) or an error insetting the direction of the original document. In this case, theoriginal document must be again set and the copying operation isrequired to be performed again.

When images of four sheets of original document written as shown in FIG.21A such that characters “A”, “B”, “C” and “D” are respectively writtenare contracted so as to be combined and output onto one sheet by theabove-mentioned function, the images of the four original documentsheets are contracted and output, as shown in FIG. 21B. Theabove-mentioned function is realized by contracting the images of theread original document into one-fourth and forming the characters A, B,C and D shown in FIG. 21B in this order.

However, the above-mentioned situation is changed attributable to a factwhether the original document intended to be copied is a longitudinaldocument or a lateral document (landscape/portrait).

If images of four sheets of lateral original document written as shownin FIG. 24A such that characters “A”, “B”, “C” and “D” are respectivelywritten are contracted so as to be combined and output onto one sheet bythe above-mentioned function, the images are contracted and simplyformed in the sequential order as A, B, C and D shown in FIG. 24B.Therefore, an output image is disordered as shown in FIG. 24B such thatthe characters are formed in an unexpected order.

That is, although the above-mentioned function enables a required copiedimage to be formed in which respective images are formed adequately ifthe original document is formed in the longitudinal direction, anadditional function is required with which the lateral direction of theoriginal document is instructed in the case where the original documentis a lateral directional document and which is able to adequately changethe forming order of the respective original document sheets.

Although a case where the function of contracting a plurality oforiginal document sheets to combine and output the images into one sheetcannot be obtained has been described which takes place in theabove-mentioned case in which

(1) the original document is longitudinal/lateral. Moreover, theabove-mentioned function cannot attain a required object attributable to

(2) the vertical direction in which the original document is set;

(3) whether the image on the original document is written longitudinallyor laterally;

(4) mixture of longitudinal original documents and lateral originaldocument;

(5) mixture of original documents facing upwards and those facingdownwards; and

(6) inadequate direction of the paper sheet cassette which has been set.

In order to adequately use the above-mentioned function, a user mustrecognize the function and adequately set the original document orarrange the order of the original documents to be adaptable to theabove-mentioned function or again perform the copying operation.However, if original documents are mixed as described in (4) and (5),the user must rearrange the direction of the original documents.

Also in a case where a plurality of original document sheets are copiedto both sides of one output sheet,

(7) the direction of the original document when the both-side copyingoperation is performed sometimes results in an unsatisfactory resultbeing obtained.

As described above, when the function of contracting a plurality oforiginal document sheets to combine and output the images onto one sheetor a double-side output function is used by the conventional copyingmachine, a required copy cannot be obtained in many cases attributableto the direction of the original document whether the image is formed inthe longitudinal direction or the lateral direction or the sides of thesame whether the original document faces upwards or downwards and thedirection of the paper sheet cassette. Erroneous use of theabove-mentioned function provided for the purpose of improving theappearance of the copy and reducing the quantity of copying sheetsraises a problem of inconvenience for a user or increase in the quantityof paper attributable to the required re-copying operation.

BRIEF SUMMARY OF THE INVENTION

An object of the present invention is to improve an image processingapparatus which has a function for contracting a plurality of originaldocument sheet images to combine the images and output the images on onesheet or outputting the images on a both sides of a sheet. Anotherobject of the present invention is to provide an image processingapparatus capable of obtaining a required copy output regardless of thedirection of an original document images employed by a user and adirection of an original document sheets set by the user.

In order to achieve the above object, according to one aspect of thepresent invention, there is provided an image processing apparatus forperforming a predetermined process on images read from originals,thereby to form an output image, comprising: means for detecting thedirections of a plurality of images read from originals when the imagesrequired to be combined are output on one image forming medium; andmeans for combining the plurality of images into a single compositeimage in accordance with a result of detection performed by thedetection means, thereby to form an output image to be formed on the oneimage forming medium.

According to another aspect of the present invention, there is providedan image processing apparatus for performing a predetermined process onimages read from originals, thereby to form an output image, comprising:means for binary-coding an image signal of a target pixel in an imagerequired to be processed; means for expanding black pixels of the imagesignal binary-coded by the binary-coding means; means for connecting aplurality of black pixel regions obtained by expanding the black pixelsby the expanding means; means for extracting the circumscribingrectangle of the regions connected by the connection means; means fordetermining the direction of an image in accordance with thecharacteristics of the position and the size of the circumscribingrectangle and the direction of characters in the circumscribingrectangle extracted by the circumscribing-rectangle extracting means;and image combining means for orienting the plurality of images in thesame direction in accordance with a result of detection performed by thedetection means and combining the plurality of images into one compositeimage.

Black pixels of image signals are expanded, a plurality of black pixelregions obtained by expanding the black pixels are connected to eachother, and the circumscribing rectangles of the connected regions areextracted. In accordance with characteristics of the positions and sizesof the extracted circumscribing rectangles and the direction ofcharacters in the circumscribing rectangles, whether the direction ofthe image is longitudinal or lateral and whether the image faces upwardsor downwards are determined. In accordance with a result of thedetermination, configuration of the plural original document images on asheet is decided. The plural original documents are combined into onecomposite image with the decided configuration. Therefore, a requiredcopy output can be obtained regardless of the direction of the originaldocument employed by a user and the direction of the original documentset by the same.

Additional objects and advantages of the invention will be set forth inthe description which follows, and in part will be obvious from thedescription, or may be learned by practice of the invention. The objectsand advantages of the invention may be realized and obtained by means ofthe instrumentalities and combinations particularly pointed out in theappended claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate presently preferred embodiments ofthe invention, and together with the general description given above andthe detailed description of the preferred embodiments given below, serveto explain the principles of the invention.

FIG. 1 is a schematic view showing the structure of a digital copyingmachine;

FIG. 2 is a block diagram showing the schematic structure of the digitalcopying machine for explaining an embodiment of the present invention;

FIG. 3 is a block diagram showing the schematic structure of an imageprocessing section;

FIG. 4 is a diagram showing an example of stored image data in a buffermemory region;

FIG. 5 is a diagram showing an example of stored composite image data inan image combining region;

FIG. 6 is a block diagram showing the schematic structure of an imagecombination processing section;

FIG. 7 is a block diagram showing the schematic structure of an imagedirection detection section;

FIG. 8 is a diagram showing an example of a binary-coding means;

FIGS. 9A and 9B are diagrams showing a run expansion processing method;

FIG. 10 is a diagram showing an example of a circuit for executing therun expansion process;

FIGS. 11A and 11B are diagrams showing a specific example of run in therun expansion process and an example of stored run information;

FIG. 12 is a diagram showing an example of stored labeling information;

FIGS. 13A to 13C are diagrams showing the principle of a method ofextracting a circumscribing rectangle;

FIG. 14 is a diagram showing an example of stored information forextracting a circumscribing rectangle;

FIGS. 15A to 15F are diagrams showing conditions for determining thesize of the circumscribing rectangle;

FIG. 16 is a block diagram showing a specific example of the structureof a circuit for forming the labeling means and the circumscribingrectangle extracting means;

FIGS. 17A and 17B are diagrams showing a method of determining whetheror not the original document faces upwards or downwards;

FIGS. 18A and 18B are diagrams showing a method of determining whetheror not the original document faces upwards or downwards;

FIGS. 19A and 19B are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIGS. 20A and 20B are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIGS. 21A and 21B are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIGS. 22A and 22B are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIG. 23 is a block diagram showing the schematic structure of an imagesize conversion/image rotation means;

FIGS. 24A and 24B are diagrams showing the configuration relationshipbetween the original document and the composite image realized by aconventional structure;

FIGS. 25A to 25D are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIG. 26 is a diagram showing an example of stored image data in thebuffer memory region;

FIG. 27 is a diagram showing an example of stored composite image datain the image combining region;

FIGS. 28A to 28D are diagrams showing the relationship of configurationbetween the original document and the composite image;

FIG. 29 is a diagram showing an example of stored image data in thebuffer memory region;

FIG. 30 is a diagram showing an example of stored composite image datain the image combining region;

FIGS. 31A to 31E are diagrams showing the relationship of configurationbetween the original document and the copied image;

FIG. 32 is a diagram showing an example of stored composite image datain the image combining region;

FIG. 33 is a diagram showing an example of an image of an originaldocument;

FIGS. 34A and 34B are diagrams showing examples of composite images;

FIGS. 35A to 35C are diagrams showing examples of images of originaldocuments;

FIGS. 36A to 36C are diagrams showing examples of the image of theoriginal document;

FIG. 37 is a block diagram showing the structure of a white paperdetermination means;

FIG. 38 is an equivalent circuit diagram showing the binary-coding meansshown in FIG. 37;

FIG. 39 is an equivalent circuit diagram showing the structure of ablack pixel counting means shown in FIG. 37;

FIG. 40 is an equivalent circuit diagram showing the structure of thedetermination means shown in FIG. 37;

FIGS. 41A and 41B are diagrams showing examples of images of originaldocuments;

FIG. 42 is a diagram showing an example of a copied image; and

FIG. 43 is a diagram showing an example of the copied image.

DETAILED DESCRIPTION OF THE INVENTION

An embodiment of the present invention will now be described withreference to the drawings.

FIG. 1 is a schematic view showing the internal structure of a digitalcopying machine having a function of printing data supplied from anexternal unit (a personal computer or the like) and serving as an imageprocessing apparatus according to the present invention.

As shown in FIG. 1, the digital copying machine has a apparatus body 10.The apparatus body 10 includes a scanner section 4 serving as a readingmeans (an image input section) and a printer section 6 serving as animage forming means (an image recording section), which will bedescribed later.

An original-document retainer 12, comprising a transparent glass plateon which original document D having an image, to be read, that is, to beprocessed, is placed, is formed on the top surface of the apparatus body10. An automatic document feeder (hereinafter called as an “ADF”) 7 forautomatically feeding the original document onto the original-documentretainer 12 is disposed on the top surface of the apparatus body 10. Thedisposed ADF 7 can be opened and closed with respect to theoriginal-document retainer 12 so as to as well as serve as a documentretainer for bringing the original document D placed on theoriginal-document retainer 12 into close contact with the surface of theoriginal-document retainer 12.

The ADF 7 has an original-document tray 8 in which the original documentD is set, an empty sensor 9 for detecting whether or not an originaldocument exists, a pickup roller 14 for sequentially taking the originaldocument sheets from the original-document tray 8, a paper supply roller15 for conveying the taken original document, an aligning roller pair 16for aligning the leading ends of the original document sheets, a sizesensor 17 for detecting the size of the original document D and aconveying belt 18 disposed to substantially cover the overall body ofthe original-document retainer 12. A plurality of the original documentsheets upwardly set in the original-document tray 8 are sequentiallytaken out such that the uppermost sheet is first taken out, and thenaligned by the aligning roller pair 16. Then, the original document isconveyed to a predetermined position in the original-document retainer12 by the conveying belt 18.

In the ADF 7, an inversion roller 20, a non-inversion sensor 21, aflapper 22 and a sheet discharge roller 23 are disposed in an endportion opposite to the aligning roller pair 16 while interposing theconveying belt 18. The original document D, the image information ofwhich has been read by a scanner section 4, to be described later, isfed from the top surface of the original-document retainer 12 by theconveying belt 18. Then, the original document D is discharged to theupper surface of an original-document discharge section 24 on the topsurface of the ADF 7 through the inversion roller 20, the non-inversionsensor 21 and the flapper 22. When the reverse side of the originaldocument D is read, the flapper 22 is switched so that the originaldocument D, which has been conveyed by the conveying belt 18, isinverted by the inversion roller 20. Then, the original document D isagain conveyed to the predetermined position on the original-documentretainer 12 by the conveying belt 18.

The scanner section 4 disposed in the apparatus body 10 has an exposurelamp 25 serving as a light source for irradiating the original documentD placed on the original-document retainer 12 with light; and a firstmirror 26 for deflecting light reflected by the original document D intoa predetermined direction. The exposure lamp 25 and the first mirror 26are attached to a first carriage 27 disposed below the original-documentretainer 12.

The first carriage 27 is disposed to be movable in parallel to theoriginal-document retainer 12, the first carriage 27 being reciprocatedbelow the original-document retainer 12 by a drive motor through atoothed belt or the like (not shown).

A second carriage 28 capable of moving in parallel to theoriginal-document retainer 12 is disposed below the original-documentretainer 12. Second and third mirrors 30 and 31 for sequentiallydeflecting light reflected by the original document D and deflected bythe first mirror 26 are attached to the second carriage 28 such that thesecond and third mirrors 30 and 31 are disposed perpendicular to eachother. The second carriage 28 follows the operation of the firstcarriage 27 by the toothed belt or the like for moving the firstcarriage 27. Moreover, the second carriage 28 is moved in parallel tothe original-document retainer 12 at speed which is half of the speed ofthe first carriage 27.

An image forming lens 32 for converging light reflected by the thirdmirror 31 on the second carriage 28 and a CCD sensor 34 for receivingand photo-electrically converting reflected light converged by the imageforming lens 32 are disposed below the original-document retainer 12.The image forming lens 32 is, through a drive mechanism, movablydisposed in a plane including the optical axis of light deflected by thethird mirror 31 to move so as to image reflected light with a requiredmagnification. The CCD sensor 34 photoelectrically converts incidentalreflected light to transmit an electric signal corresponding to the readoriginal document D. That is, the CCD sensor 34 converts light emittedfrom the light source and reflected from the original document into anelectric signal for each unit pixel obtained by longitudinally andlaterally dividing the image of the original document so as to transmit8-bit digital data for each pixel.

On the other hand, the printer section 6 is provided with a laserexposure section 40 serving as a latent image forming means. The laserexposure section 40 has a semiconductor laser 41 serving as the lightsource, a polygonal mirror 36 serving as a scan member for successivelydeflecting laser beams emitted from the semiconductor laser 41, apolygon-mirror motor 37 serving as a scan motor for rotating thepolygonal mirror 36 at a predetermined number of revolutions to bedescribed later and an optical system 42 for deflecting the laser beamsupplied from the polygonal mirror 36 to introduce the deflected laserbeam into the surface of a photosensitive drum 44 to be described later.The laser exposure section 40 having the above-mentioned structure issecured and supported by a support frame (not shown) of the apparatusbody 10.

The semiconductor laser 41 is controlled so as to be turned on or off inaccordance with image information of the original document D read by thescanner section 4 or document information transmitted or received by afacsimile method. Laser beams emitted from the semiconductor laser 41are allowed to pass through the polygonal mirror 36 and the opticalsystem 42 to be allowed to propagate to the photosensitive drum 44.Thus, the outer surface of the photosensitive drum 44 is scanned so thata latent image is formed on the outer surface of the photosensitive drum44.

The printer section 6 has the photosensitive drum 44 serving as an imagecarrier disposed in the substantially central portion of the apparatusbody 10. The outer surface of the photosensitive drum 44 is exposed bythe laser beam supplied from the laser exposure section 40 so that arequired latent image is formed. The following elements are sequentiallydisposed around the photosensitive drum 44: an electrorifying charger 45for electrically charging the outer surface of the photosensitive drum44 to a predetermined charge level; a developing unit 46 for supplyingtoner serving as a developer to the latent image formed on the outersurface of the photosensitive drum 44 to develop the latent image with arequired image density; a transfer charger 48 integrally comprising aseparation charger 47 for separating a member, to which an image must betransferred, that is, copy sheet P, from the photosensitive drum 44 andarranged to transfer a toner image formed on the photosensitive drum 44to the paper P; a separation claw 49 for separating the copy paper Pfrom the outer surface of the photosensitive drum 44; a cleaning section50 for cleaning up toner left on the outer surface of the photosensitivedrum 44; and a destaticizer 51 for destaticizing the outer surface ofthe photosensitive drum 44.

An upper cassette 52, a middle cassette 53 and a lower cassette 54, eachof which can be drawn from the apparatus body 10, are disposed in thelower portion of the apparatus body 10 in such a manner that thecassettes 52, 53 and 54 are disposed vertically. The cassettes 52, 53and 54 respectively accommodate copy paper sheets having differentsizes. A large-capacity feeder 55 is disposed on the side of theabove-mentioned cassettes 52, 53 and 54. The large-capacity feeder 55accommodates about 300 sheets of copy paper P having A4-size. A paperfeeding cassette 57 also serving as a manual feeding tray 56 isdetachably mounted above the large-capacity feeder 55.

The apparatus body 10 includes a conveying passage 58 extending fromeach cassette and the large-capacity feeder 55 to pass through atransferring section formed between the photosensitive drum 44 and thetransfer charger 48. A fixing unit 60 is disposed at an end of theconveying passage 58. A discharge opening 61 is formed in the side wallof the apparatus body 10 facing the fixing unit 60. A sheet dischargetray 62 is inserted into the discharge opening 61.

A pickup roller 63 for sequentially taking out the copy paper P from anyone of the cassettes 52, 53, 54 and 57 or the large-capacity feeder 55is disposed adjacent to each of the cassettes 52, 53, 54 and 57.Moreover, a multiplicity of paper supply roller pairs 64 for conveyingthe copy paper P taken from the paper supply roller pair 64 through theconveying passage 58 are disposed in the conveying passage 58.

A resist roller pair 65 is disposed in the conveying passage 58 at aposition upstream from the photosensitive drum 44. The resist rollerpair 65 corrects inclination of the extracted copy paper P, aligns theleading end of the toner image on the photosensitive drum 44 and theleading end of the copy paper P and moves the copy paper P to thetransferring section at the same speed as that of the outer surface ofthe photosensitive drum 44. A pre-alignment position sensor 66 fordetecting the copy paper P which has been conveyed is disposed in frontof the resist roller pair 65, that is, at a position adjacent to thepaper supply roller pair 64.

The sheets of the copy paper P, which have been, one by one, taken outfrom each cassette or the large-capacity feeder 55 by the pickup roller63, are conveyed to the resist roller pair 65 by the paper supply rollerpair 64. Then, the leading end of the copy paper P is aligned by theresist roller pair 65, and then moved to the transferring section.

In the transferring section, a developed image formed on thephotosensitive drum 44, that is, the toner image, is transferred to theupper surface of the copy paper P by the transfer charger 48. The copypaper P having the transferred toner image is separated from the outersurface of the photosensitive drum 44 attributable to the operation ofthe separation charger 47 and the separation claw 49, and then moved tothe fixing unit 60 through a conveying belt 67 which forms a portion ofthe upper cassette 52. Then, the developed image is fused and fixed tothe copy paper P by the fixing unit 60. Then, the copy paper P isallowed to pass through a discharge opening 61 so as to be discharged tothe upper surface of the sheet discharge tray 62 by the paper supplyroller pair 68 and the paper-discharge roller pair 69.

An automatic double-side unit 70 for inverting the copy paper P allowedto pass through the fixing unit 60 to again move the copy paper P to theresist roller pair 65 is disposed below the conveying passage 58. Theautomatic double-side unit 70 has a temporary accumulation section 71for temporarily accumulating the copy paper P, an inversion passage 72for inverting the copy paper P allowed to pass through the fixing unit60 to introduce the copy paper P to the temporary accumulation section71, a pickup roller 73 for, one by one, extracting the sheets of thecopy paper P accumulated in the temporary accumulation section 71 and apaper supply roller 75 for moving the extracted paper to the resistroller pair 65 through the conveyance passage 74. A distribution gate 76for selectively distributing the copy paper P to the discharge opening61 or the inversion passage 72 is disposed at a branch portion betweenthe conveying passage 58 and the inversion passage 72.

When the double-side copying operation is performed, the copy paper Pallowed to pass through the fixing unit 60 is introduced into theinversion passage 72 by the distribution gate 76. Then, the invertedsheets of the copy paper P are temporarily accumulated in the temporaryaccumulation section 71, and then allowed to pass through the conveyancepassage 74 so as to be moved to the resist roller pair 65 by the pickuproller 73 and the paper supply roller 75. Then, the copy paper P isaligned by the resist roller pair 65, and then the copy paper P is againmoved to the transferring section so that the toner image is transferredto the reverse side of the copy paper P. Then, the copy paper P isallowed to pass through the conveying passage 58, the fixing unit 60 andthe paper-discharge roller pair 69, and then discharged to the uppersurface of the sheet discharge tray 62.

The digital copying machine further includes an operation panel 80 and amain control section 90 shown in FIG. 2.

The operation panel 80 has a print key 81 for instructing to start thecopying operation, an input section 82 having a plurality of depressionbutton switches or color cathode ray tube or a structure having atransparent touch-sensor panel formed on a liquid crystal screen inorder to input conditions for the image output from the digital copyingmachine, for example, the number of copies or prints, the magnificationor instruction of partial copying operation and the coordinates of theregion of the partial copying operation, a panel CPU 83 for controllingthe operation panel 80 and a ten-key pad 84 for use to set the number ofcopies and the magnification of the copy.

The input section 82 has a touch sensor arranged to correspond to theoperation sequence of the digital copying machine or the conditions tobe input, the input section 82 having, for example, icons, figures,characters or character strings to serve as a plurality of input keys.For example, a combination mode key and a soft key are provided for theinput section 82. Moreover, the input section 82 has a display section82 a on which operation guide and input contents are displayed. As thecombination mode key, there are provided a 4in1 mode key for copyingfour original document sheets on one copy paper P, a 2in1 mode key forcopying two original document sheets on one copy paper P and adouble-side mode key for copying two original document sheets on onecopy paper P.

The display section 82 a displays the number of copies, the copyingmagnification, copy permission, the memory capacity permitted for use ina sorting operation and the number (a measure) of sheets of originaldocument which can be read with respect to the memory capacity.

Moreover, the display section 82 a displays a message for causing a userto confirm the direction of the image or to determine whether or not theoperation will be continued in accordance with a result of determinationperformed by a copy determining means 161, to be described later.

In response to the above-mentioned message, whether or not the operationwill be continued is input by using the keys from the input section 82.

FIG. 2 is a block diagram schematically showing flow of signals for usein establishing the electrical connections in the digital copyingmachine and controlling the same shown in FIG. 1. Referring to FIG. 2,the digital copying machine has a main CPU 91 in a main control section90, a scanner CPU 100 in the scanner section 4 and a printer CPU 110 inthe printer section 6. The main CPU 91 holds bi-directionalcommunication with the printer CPU 110 through a shared RAM 95. The mainCPU 91 issues an instruction to perform the operation, while the printerCPU 110 returns a status of the apparatus. The printer CPU 110 and thescanner CPU 100 hold serial communication. The printer CPU 110 issues aninstruction to perform the operation, while the scanner CPU 100 returnsstatus of the apparatus.

The operation panel 80 is connected to the main CPU 91.

The main control section 90 is composed of the main CPU 91, the ROM 92,the RAM 93, a NVM 94, the shared RAM 95, an image processing section 96,a page memory control section 97, a page memory 98, a printer controller99 and a printer font ROM 151.

The main CPU 91 controls the overall operations of the main controlsection 90. The ROM 92 stores a control program. The RAM 93 temporarilystores data.

The NVM (nonvolatile RAM) 94 is a nonvolatile memory backed up by abattery (not shown) and arranged to save data thereon when the electricpower has been turned off.

The shared RAM 95 is arranged to hold bi-directional communicationbetween the main CPU 91 and the printer CPU 110.

The main CPU 91 determines the reduction (or enlargement) ratio inaccordance with the size of the original document, the size of the copypaper and the combination mode when the combination (print) mode hasbeen employed. Then, the main CPU 91 reduces (or enlarges) the size ofimage data read by the scanner section 4 with the reduction (or theenlargement) ratio to store image data above in the buffer memory region98 a of the page memory 98.

The main CPU 91 determines whether the original document is alongitudinal document or a lateral document in accordance with an outputfrom the size sensor 17. A result of the determination is arranged to besupplied to an image direction detection means 160.

The image processing section 96 is, as shown in FIG. 3, composed of alow pass filter section 96 a for eliminating noise in the image, aground removing section 96 b for correcting the density of the ground ofthe image, a high pass filter section 96 c for highlighting edges of theimage, a γ-correction section 96 d for correcting the recording densitycharacteristic of the printer section 6 and a gradation processingsection 96 e for binary-coding an 8-bit signal while maintaining thegradient and the character gradient so as to convert the signal into a1-bit signal.

The page memory control section 97 stores image data in the page memory98 and read image data from the same. The page memory 98 has a regionwhich is capable of storing image data for a plurality of pages, thepage memory 98 being composed of a buffer memory region 98 a, which iscapable of storing image data for one page supplied from the scannersection 4 and an image combining region 98 b which is capable of storingcomposite image data. The page memory control section 97 is providedwith an image combination processing section 97 a which is used when thecombination mode is employed.

The buffer memory region 98 a sequentially stores image data for onescan line for each original document as shown in FIG. 4 when, forexample, the 4in1 mode is employed as the combination mode. When the4in1 mode has been employed as the combination mode and all of theoriginal document sheets are in the form of the longitudinal documentfacing upwards and having lateral images, image data stored in thebuffer memory region 98 a is contracted to one-fourth and stored in theimage combining region 98 b such that image data on the first page isstored in the upper left portion, that on the second page is stored inthe upper right portion, that on the third page is stored in the lowerleft portion and that on the fourth page is stored in the lower leftportion, as shown in FIG. 5. Synthesized image data stored in the imagecombining region 98 b is read in the sequential order as the first lineof image data on the first page, the first line of image on the secondpage, the second line of image on the first page, the second line ofimage data on the second page, . . . , so as to be supplied to theprinter section 6 through the image data bus 150.

The printer font ROM 151 stores font data corresponding to print data.

The printer controller 99 develops print data supplied from an externalapparatus 130, such as a personal computer, with the resolutionindicated by data provided for print data above, the printer controller99 using font data stored in the printer font ROM 151 when it performsthe development.

The scanner section 4 has a scanner CPU 100 for totally controlling thescanner section 4, a ROM 101 in which the control program and the likeare stored, a RAM 102 for storing data, a CCD driver 103 for operatingthe CCD sensor 34, a scan motor driver 104 for controlling rotation of amotor for moving the exposure lamp 25 and the mirrors 26, 27 and 28, andan image correction section 105 consisting of an A/D conversion circuitfor converting an analog signal supplied from the CCD sensor 34 into adigital signal, a shading correction circuit for correcting change inthe threshold level for an output signal from the CCD sensor 34occurring due to dispersion of the CCD sensor 34 and the change in theambient temperature and a line memory for temporarily storing thedigital signal, which has been supplied from the shading correctioncircuit and which has been subjected to the shading correction process.

The printer section 6 consists of a printer CPU 110 for totallycontrolling the printer section 6, a ROM 111, in which the controlprogram and the like are stored, a RAM 112 for storing data, a laserdriver 113 for turning on or off light emission from the semiconductorlaser 41, a polygonal-mirror-motor driver 114 for controlling rotationof the polygon-mirror motor 37 in the laser exposure section 40, a paperconveying section 115 for controlling conveyance of the copy paper Pthrough the conveying passage 58, a development processing section 116for performing electric charge, development and transference by usingthe electrorifying charger 45, the developing unit 46 and the transfercharger 48, a fixing control section 117 for controlling the fixing unit60 and an option section 118.

The image processing section 96, the page memory control section 97, thepage mentory 98, the printer controller 99, the image correction section105 and the laser driver 113 are connected to one another by the imagedata bus 150.

The image combination processing section 97 a is composed of an imagedirection detection means 160, a copy determining means 161, an imageposition determining means 162 and animage-size-conversion/image-rotation means 163, as shown in FIG. 6.

The image direction detection means 160 uses image data for one pagesupplied from the image correction section 105 in the scanner section 4through the image data bus 150 to determine whether the direction ofcharacters is lateral or longitudinal, whether the original document iswritten longitudinally or laterally and whether the image faces upwardsor downwards.

The copy determining means 161 determines whether or not the operationfor copying the image is interrupted if the directions of the originaldocument sheets are different from one another, the determination beingperformed in accordance with a result of the detection of the directionof the plural original document sheets supplied from the image directiondetection means 160.

The image position determining means 162 determines the size of theimage which must be converted, an angle required to be rotated and thepositions of the images in accordance with the direction of the originaldocument and a result of the detection of the direction performed by theimage direction detection means 160.

The image-size-conversion/image-rotation means 163 uses a result of thedetermination performed by the image position determining means 162 anda copy method signal supplied from the main CPU 91 to transmit imagememory address to the page memory 98. Theimage-size-conversion/image-rotation means 163 supplies the read addressin the buffer memory region 98 a and write address in the imagecombining region 98 b when the images are combined.

The image direction detection means 160 is, as shown in FIG. 7, composedof a binary coding means 121, a run expansion means 122, a labelingmeans 123, a circumscribing-rectangle extraction means 124, a characterdirection determination means 125 and an image direction determinationmeans 126.

That is, symbols S0 represent a supplied image signal. Input imagesignal S0 is subjected to a comparison with a predetermined thresholdvalue Th in the binary coding means 121 so as to be binary-coded so thata binary-coded image signal S1 is transmitted. The binary coding means121 is composed of a threshold value memory for storing the thresholdvalue Th and a comparator for subjecting the input image signal S0 andthe threshold value Th to a comparison. If the input image signal S0 issmaller than the binary-coded threshold value Th, the binary codingmeans 121 transmits “0” as the binary-coded image signal S1. If theinput image signal S0 is larger than the binary-coded threshold valueTh, the binary coding means 121 transmits “1”. The comparison process isperformed in accordance with the following equation (1):

S1=0:S0<Th

S1=1:S0≧Th  (1)

FIG. 8 shows the structure of the binary coding means 121. The binarycoding means 121 comprises an 8-bit comparator. An 8-bit input imagesignal 1 and a predetermined 8-bit threshold value Th are subjected to acomparison so that the binary-coded image signal S1 is, under thecondition expressed in equation (1), supplied to the run expansion means122 and the character direction determination means 125.

The thus-binary-coded image signal by the various binary coding means121 is subjected to a process for expanding black pixels in the mainscan direction by the run expansion means 122. The run expansion means122 performs the image expansion process in response to the binary-codedimage signal S1.

If a black pixel exists in a range of a predetermined number of pixelsfrom a target pixel (a black pixel) in the main scan direction, all ofpixels from the target pixel to the above-mentioned pixel are replacedby black pixels.

The run expansion will be explained in detail with reference to FIGS. 9Aand 9B. For facilitating the explanation, the range of the number ofpixels is set to “4”. In FIGS. 9A and 9B, the position of each pixel ofa binary image is expressed by coordinates (i, j) in the X and Ydirections.

Suppose a case as shown in FIG. 9A, where black pixels continue from aposition with coordinates (2, 1) to a position with coordinates (5, 1)in the main scan direction, and further black pixels continue from aposition with coordinates (8, 1) to a position with coordinates (12, 1)in the main scan direction, with two white pixels interposedtherebetween. In this case, the interposed white pixels are replacedwith black pixels, and accordingly a run (black pixel portion) L1 asshown in FIG. 9B is obtained in which black pixels continue from theposition with coordinates (2, 1) to the position with coordinates (12,1).

As regards pixels with coordinates (1, 2) in FIG. 9A, black pixelscontinue from a position with coordinates (1, 2) to a position withcoordinates (3, 2) in the main scan direction. However, no black pixelsexist within a range of 4 pixels from a position with coordinates (4,2). Therefore, no change is made to pixels from the position withcoordinates (4, 2) to a position with coordinates (8, 2), therebyproviding a run L2 as shown in FIG. 9B.

Similarly, a white pixel existing between a black pixel with coordinates(11, 2) and a black pixel with coordinates (13, 2) is replaced with ablack pixel, thereby obtaining a run L3 which continue from a blackpixel with coordinates (9, 2) to a black pixel with coordinates (16, 2),as shown in FIG. 9B. As described above, where there is a black pixelwithin a range of four pixels in the main scan direction, any whitepixel between black pixels is replaced with a black pixel.

FIG. 10 shows an example of a circuit for performing the run expansion.In the FIG. 10 case, the binary pixel signal S1 is input to a latchcircuit 130 a. The latch circuit 130 a and latch circuits 130 b to 130 hare connected in series such that the output of each of the latchcircuits is input to the next one connected thereto. In other words, abinary pixel signal S1 (a binary pixel value) corresponding to a firstpixel is input to the latch circuit 130 a together with an image clockpulse in synchronism with the first pixel. Then, the signal S1 islatched (temporarily held) by the latch circuit (which consists of aflip-flop circuit) 130 a in synchronism with the image clock pulse, andoutput to the next latch circuit 130 b. The next latch circuit 130 blatches the binary pixel value corresponding to the first pixel insynchronism with the image clock pulse corresponding to a second pixel.At this time, the latch circuit 130 a latches a binary pixel valuecorresponding to the second pixel. Thus, the binary pixel value latchedby each of the latch circuits is output to and latched by the next latchcircuit.

The outputs of the latch circuits 130 a to 130 g are input to an ORcircuit 134. The binary pixel signal S1 to be input to the first latchcircuit 130 a is also input to the OR circuit 134. The OR circuit 134calculates the logical sum of them, and outputs it as a signal FLAG1 toan AND circuit 132. The binary pixel value output from the last latchcircuit 130 h is input to an OR circuit 133 and also to the invertedterminal of the AND circuit 132.

Supposing that the binary pixel value BIN latched by the latch circuit130 h is a target pixel, binary pixel values latched by the latchcircuits 130 a to 130 g and a binary pixel value to be input to thelatch circuit 130 a respectively correspond to first through eighthpixels output after the target pixel. The OR circuit 131 outputs “1” asthe signal FLAG1 if the first through eighth pixels include at least oneblack pixel, and outputs “0” as the signal FLAG1 if they include noblack pixels. In other words, it can be determined from the signal FLAG1whether or not at least one black pixel is included in 8 pixels outputafter the target pixel.

The binary pixel value BIN, the signal FLAG1, and a run expansion signalEXO (explained later) corresponding to a pixel scanned immediatelybefore the target pixel are input to the AND circuit 132. If the targetpixel latched by the latch circuit 130 h is a white pixel, the ANDcircuit 132 determines whether or not black pixels between which thewhite pixel is situated are included in continuous 8 pixels, and outputsa signal FLAG2 indicative of the determination result. The value of thesignal FLAG2 is determined as follows:

If the signal BIN is set at “0”, the signal FLAG1 at “1”, and the signalEXO at “1”, the signal FLAG2 is set to “1”;

If any of these conditions is not satisfied, the signal FLAG2 is set to“0”.

The OR circuit 133 receives the binary pixel value BIN of the targetpixel and the output signal FLAG2 of the AND circuit 132, and outputs arun expansion signal S2. The value of the signal S2 is determined asfollows:

If the signal BIN is set at “1”, or the signal FLAG2 at “1”, the runexpansion signal S2 is set to “1”;

If the signal BIN is set at “0”, and the signal FLAG2 at “0”, the runexpansion signal S2 is set to “0”.

The above-described run expansion signal EXO corresponding to a pixelscanned immediately before the target pixel is obtained by delaying therun expansion signal S2 output from the OR circuit 133, by one pixel bymeans of a latch circuit 134 in synchronism with the image clock. On thebasis of the run expansion signal S2 output as data concerning each run(each black pixel portion) extracted from a binary image, thecoordinates of the start position of the run, those of the end positionof the run, and the length of the run are obtained.

The labelling means 123 shown in FIG. 7 will now be explained. Thelabelling means 123 performs labelling processing, wherein connectedruns are integrated as one region, on the basis of the run expansionsignals S2 output by the run expansion means 122.

FIG. 11A shows examples of runs extracted by the run expansion means122, and FIG. 11B a table which stores examples of run data obtainedfrom the run expansion signals S2 corresponding to the runs shown inFIG. 11A.

The table of FIG. 11B stores a run number assigned to each run, thecoordinates of the start position of the run, those of the end positionof the run, and the length of the run. The labelling means 123 performslabelling on the basis of the run data. The run data may be stored in apredetermined memory area in the image processing apparatus of theinvention.

In FIG. 11A, a run L10 with a run number of “1”is connected to a run L11with a run number of “2”, and further to a run L12 with a run number of“3”. In other words, the runs L10 to L12 are all connected. Thelabelling means 123 integrates these runs as one region.

FIG. 12 shows data concerning integrated regions resulting fromintegrating the runs shown in FIG. 11A. A label “A” is assigned to anintegrated region including connected runs with run numbers “1”, “2” and“3”, and the run numbers are stored as data indicating the feature ofthe region. The data shown in FIG. 12 is output as a signal S3 to thecircumscribing-rectangle extraction means 124.

The circumscribing-rectangle extraction means 124 will be explained.This means determines the position and size of a rectangle whichcircumscribes each region integrated by the labelling means 123.Referring to FIGS. 13A to 13C, the principle of extraction of acircumscribing rectangle will be explained first.

FIG. 13A shows an example of a region from which a circumscribingrectangle is extracted, and which is the same region as that shown inFIG. 12 and has the label “A” assigned. That is, the region shown inFIG. 13A includes connected runs with the run numbers “1”, “2” and “3”.To determine the size of this region, comparison is made concerning thestart points, the end points, the lengths, etc. of the runs extendingfrom left to right on a target line and a line previous to the targetline.

More specifically, take attention first to the run L11 on the targetline and the run L10 on the previous line in FIG. 13A. Since theX-coordinate of the start point of the run L11 is lower than that of thestart point of the run L10, the start point of the run L11 serves as thestart point of a circumscribing rectangle which circumscribes the runsL10 and L11. On the other hand, since the X-coordinate of the end pointof the run L10 is higher than that of the end point of the run L11, theend point of the run L11 serves as the end point of the circumscribingrectangle which circumscribes the runs L10 and L11. Thus, thecircumscribing rectangle which circumscribes the runs L10 and L11 isindicated by the solid line shown in FIG. 13B.

Then, take attention to the runs L12 and L10 in FIG. 13A. Since theX-coordinate of the start point of the run L10 is lower than that of thestart point of the run L12, the start point of the run L10 serves as thestart point of a circumscribing rectangle which circumscribes the runsL10 and L12. On the other hand, since the X-coordinate of the end pointof the run L12 is higher than that of the end point of the run L10, theend point of the run L12 serves as the end point of the circumscribingrectangle which circumscribes the runs L10 and L12. Further, in light ofthe circumscribing rectangle indicated by the solid line in FIG. 13B, acircumscribing rectangle which circumscribes the runs L10, L11 and L12is indicated by the solid line shown in FIG. 13C.

As regards the region with the label “A” wherein the runs L10 to L12shown in FIG. 13A are integrated, the circumscribing-rectangleextraction means 124 uses the lowest X-coordinate and the lowestY-coordinate of the coordinates (x1, y1), (x2, y2) and (x3, y3) of thestart points of the runs L10 to L12, as the coordinates (xs, ys) of thestart point of the circumscribing rectangle. In other words, where thecoordinates of the start points of a number n of runs included in aregion with a certain label are (x1, y1), (x2, y2), . . . , (xn, yn),the coordinates (xs, ys) of the start point of the circumscribingrectangle of the runs are given by

xs=min (x1, x2, . . . , xn)

ys=min (y1, y2, . . . , yn)

Similarly, the coordinates (xe, ye) of the end point of thecircumscribing rectangle are given by

xe=max (x1, x2, . . . , xn)

ye=max (y1, y2, . . . , yn)

Moreover, the size of the circumscribing rectangle, i.e. thex-directional and y-directional lengths (x1, y1), is given by

x1=xe−xs+1

y1=ye−ys+1

Circumscribing-rectangle data S4 calculated in the above-describedmanner on the basis of the run data shown in FIG. 11B are stored asshown in FIG. 14. The FIG. 14 table stores the coordinates of the startpoint and the size (x1, y1) of the circumscribing rectangle with thelabel “A”.

The specific conditions for determining the size of the circumscribingrectangle will be explained with reference to FIGS. 15A to 15F. In FIGS.15A to 15F, run data items X0, Y0, and M0 indicate the x-coordinate X0and the y-coordinate Y0 of the start point of a run L20 on a first line,and the run length M0 of the run, respectively. Run data items X1, Y1,and M1 indicate the x-coordinate X1 and the y-coordinate Y1 of the startpoint of a run L21 on a second line, and the run length M1 of the run,respectively. Moreover, the start point of a circumscribing rectangleobtained by the determination is indicated by the x-coordinate and they-coordinate, and the size of the rectangle by the x-directional lengthand the y-directional length.

To determine the size of the circumscribing rectangle, the relationshipin position between the run L20 on the first line and the run L21 on thesecond line must be determined. Specifically, six cases as shown inFIGS. 15A to 15F must be considered.

FIG. 15A is a view, useful in explaining first determination conditions,wherein the x-coordinates of the start and end points of the run L21 onthe second line are lower than those of the run L20 on the first line,and the runs L20 and L21 are not connected to each other. In otherwords, if X0>X1+M1, it is determined that the runs L20 and L21 are notconnected to each other. As a result, the start point of the obtainedcircumscribing rectangle is determined to be (X1, Y1), and the size ofthe same (M1, Y−Y1+1). Y represents the number of a line beingprocessed, and Y=Y1 in the FIG. 15A case.

FIG. 15B is a view, useful in explaining second determinationconditions, wherein the x-coordinates of the start and end points of therun L21 on the second line are lower than those of the run L20 on thefirst line, and the runs L20 and L21 are connected to each other. Inother words, if X0>X1, X0 . . . X1+M1, and X0+M0>X1+M1, the start pointof the obtained circumscribing rectangle is (X1, Y0), and the size ofthe same is (X0+M0−X1+1, Y−Y0+1).

FIG. 15C is a view, useful in explaining third determination conditions,wherein the x-coordinate of the start point of the run L21 on the secondline is lower than that of the run L20 on the first line, thex-coordinate of the end point of the run L21 is higher than that of therun L20, and the runs L20 and L21 are connected to each other. In otherwords, if X0>X1, X)≦X1+M1, and X0+M0≦X1+M1, the start point of theobtained circumscribing rectangle is (X1, Y0), and the size of the sameis (M1, Y−Y0+1).

FIG. 15D is a view, useful in explaining fourth determinationconditions, wherein the x-coordinate of the start point of the run L21on the second line is higher than that of the run L20 on the first line,the x-coordinate of the end point of the run L21 is lower than that ofthe run L20, and the runs L20 and L21 are connected to each other. Inother words, if X0≦X1, X0 . . . X1+M1, and X0+M0>X1+M1, the start pointof the obtained circumscribing rectangle is (X0, Y0), and the size ofthe same is (M0, Y−Y0+1).

FIG. 15E is a view, useful in explaining fifth determination conditions,wherein the x-coordinate of the start point of the run L21 on the secondline is higher than that of the run L20 on the first line, thex-coordinate of the end point of the run L21 is higher than that of therun L20, and the runs L20 and L21 are connected to each other. In otherwords, if X0≦X1, X0≦X1+M1, and X0+M0≦X1+M1, the start point of theobtained circumscribing rectangle is (X0, Y0), and the size of the sameis (X1+M1−X0, Y−Y0+1).

FIG. 15F is a view, useful in explaining sixth determination conditions,wherein the x-coordinates of the start and end points of the run L21 onthe second line are higher than those of the run L20 on the first line,and the runs L20 and L21 are not connected to each other. In otherwords, if X0+M0<X1, it is determined that the connection state of therun L20 on the first line and L21 is terminated. As a result, the startpoint of the obtained circumscribing rectangle is (X0, Y0), and the sizeof the same (M0, Y−Y0+1).

FIG. 16 shows examples of the labelling means 123 and thecircumscribing-rectangle extraction means 124. As is shown in FIG. 16,concerning the run expansion signal S2 from the run expansion means 122,run data (the X and Y coordinates of the start point of a run on a firstline, and the run length of the run) are stored in a memory 141 via aselector 140. The run data stored in the memory 141 are supplied tocomparators 143 a to 143 e via a selector 142, where the run dataconcerning the runs on the first and second lines are compared with eachother. Further, the run data stored in the memory 141 is supplied alsoto an adder-subtracter 144 via the selector 142, where the run data aresubjected to addition and subtraction if the runs on the first andsecond lines are connected to each other, thereby calculating thecoordinates of the start point of the integrated region includingconnected runs, the size of the region, etc.

The comparator 143 a compares the x-coordinate X0 of the start point ofa first run on the first line with the x-coordinate X1 of that of afirst run on the second line.

At this time, if X0>X1, the comparator 143 a outputs “1” as a comparisonsignal S30, whereas if X0≦X1, it outputs “0” as the signal S30.

The comparator 143 b compares the x-coordinate X0 of the start point ofthe first run on the first line with the x-coordinate (X1+M1) of the endpoint of the first run on the second line.

At this time, if X0>X1+M1, the comparator 143 b outputs “1” as acomparison signal S31, whereas if X0≦X1+M1, it outputs “0” as the signalS31.

The comparator 143 c compares the x-coordinate (X0+M0) of the end pointof the first run on the first line with the x-coordinate (X1+M1) of theend point of the first run on the second line.

At this time, if X0+M0>X1+M1, the comparator 143 c outputs “1” as acomparison signal S32, whereas if X0+M0≦X1+M1, it outputs “0” as thesignal S32.

The comparator 143 d compares the x-coordinate (X0+M0) of the end pointof the first run on the first line with the x-coordinate X1 of the startpoint of the first run on the second line.

At this time, if X0+M0>X1, the comparator 143 d outputs “1” as acomparison signal S33, whereas if X0+M0≦X1, it outputs “0” as the signalS33.

The comparator 143 e compares the y-coordinate Y0 of the start point ofthe first run on the first line with the y-coordinate Y1 of that of thefirst run on the second line.

At this time, if Y0>Y1, the comparator 143 e outputs “1” as a comparisonsignal S34, whereas if Y0≦Y1, it outputs “0” as the signal S34.

When the runs are connected to each other, the adder-subtracter 144calculates the following to obtain the size (length) of an integratedregion of the runs:

X0+M0−X1+1

or

X1+M1−X0+1

The adder-subtracter 144 supplies a selector 146 with X0, Y0, X1, Y1,M0, M1, X0+M0−X1+1, and X1+M1−X0+1 as signals S35 including calculationresults, etc.

On the basis of the signals S30, S31, S33 and S34, a determination table145 determines the positional relationship between the runs on the firstand second lines as described above. Specifically, depending upon theabove-described first through sixth determination conditions, thedetermination table 145 outputs selection signals S36 and S37 to theselectors 142 and 146 and memories 147 and 148, and a run selectionsignal S38. The run selection signal S38 is used to shift the run to beprocessed from one to another, and stored in a memory (which is notshown but also stores the run expansion signal S2).

The selection signal S37 is of 4 bits, lower three ones of which aredetermined depending upon the first through sixth determinationconditions, and the highest one of which consists of the comparisonsignal S34. Where the determination table 145 determines that the firstdetermination conditions are satisfied, i.e. where the comparison signalS31 is “1”, the run on the second line is not connected to the run onthe first line as shown in FIG. 15A. In this case, the determinationtable 145 outputs “0” as the selection signal S36, “000” as the lowerthree bits of the selection signal S37, and “1” as the run selectionsignal S38.

Where the determination table 145 determines that the seconddetermination conditions are satisfied, i.e. where the comparisonsignals S30, S31 and S32 are “1”, “0” and “1”, respectively, the run onthe second line is connected to the run on the first line as shown inFIG. 15B. In this case, the determination table 145 outputs “0” as theselection signal S36, “001” as the lower three bits of the selectionsignal S37, and “1” as the run selection signal S38.

Where the determination table 145 determines that the thirddetermination conditions are satisfied, i.e. where the comparisonsignals S30, S31 and S32 are “1”, “0” and “0”, respectively, the run onthe second line is connected to the run on the first line as shown inFIG. 15C. In this case, the determination table 145 outputs “0” as theselection signal S36, “010” as the lower three bits of the selectionsignal S37, and “0” as the run selection signal S38.

Where the determination table 145 determines that the fourthdetermination conditions are satisfied, i.e. where the comparisonsignals S30, S31 and S32 are “0”, “0” and “1”, respectively, the run onthe second line is connected to the run on the first line as shown inFIG. 15D. In this case, the determination table 145 outputs “0” as theselection signal S36, “011” as the lower three bits of the selectionsignal S37, and “1” as the run selection signal S38.

Where the determination table 145 determines that the fifthdetermination conditions are satisfied, i.e. where the comparisonsignals S30, S31 and S32 are “0”, “0” and “0”, respectively, the run onthe second line is connected to the run on the first line as shown inFIG. 15E. In this case, the determination table 145 outputs “0” as theselection signal S36, “100” as the lower three bits of the selectionsignal S37, and “0” as the run selection signal S38.

Where the determination table 145 determines that the sixthdetermination conditions are satisfied, i.e. where the comparison signalS33 is “0”, connection of the runs on the first and second lines iscompleted as shown in FIG. 15F. In this case, the determination table145 outputs “1” as the selection signal S36, “101” as the lower threebits of the selection signal S37, and “0” as the run selection signalS38.

The output of the adder-subtracter 144 is input to the selector 146,which in turn outputs label data corresponding to the lower three bitsof the selection signal S37. The word “label” means a region formed byintegrating the runs on the first and second lines, and the “label data”indicate the start point of the label, the size thereof, etc.

When the lower three bits of the selection signal S37 are “000”, theselector 146 outputs (X1, Y1) as the start point coordinates of thelabel, and (M1, Y−Y1+1) as the size of the label (see FIG. 15A).

When the lower three bits of the selection signal S37 are “001”, theselector 146 outputs (X1, Yp) as the start point coordinates of thelabel, and (M1, Y−Yp+1) as the size of the label (see FIG. 15B) (Ypindicates the lower one of y-coordinates Y0 and Y1 which is determinedby the comparator 143 a to 143 e).

When the lower three bits of the selection signal S37 are “010”, theselector 146 outputs (X1, Yp) as the start point coordinates of thelabel, and (M1, Y−Yp+1) as the size of the label (see FIG. 15C).

When the lower three bits of the selection signal S37 are “011”, theselector 146 outputs (X0, Yp) as the start point coordinates of thelabel, and (M0, Y−Yp+1) as the size of the label (see FIG. 15D).

When the lower three bits of the selection signal S37 are “100”, theselector 146 outputs (X0, Yp) as the start point coordinates of thelabel, and (X1+M1−X0+1, Y−Yp+1) as the size of the label (see FIG. 15E).

When the lower three bits of the selection signal S37 are “101”, theselector 146 outputs (X0, Y0) as the start point coordinates of thelabel, and (M0, Y−Y0+1) as the size of the label (see FIG. 15F).

The selection signal S36 selects one of a memory 147 for internalcalculation and a buffer memory 148 for outputting a result of labellingprocessing, to store therein the label data output from the selector146. Specifically, only when the sixth determination conditions aresatisfied in the determination table 145 and the run connection iscompleted (the FIG. 15F case), “1” is output as the selection signalS36. At this time, label data output as a signal S42 from the selector146 is stored in the memory 148.

The memory 147 stores the label data output as the signal S42 from theselector 146, i.e. stores run data for each line, which includes thedetermination result of the determination table 145 concerning runs onthe first and second lines, the start point coordinates of an integratedregion of the runs, the size of the region, etc. For example, while thecomparators 143 a to 143 e perform comparison processing concerning runson the first and second lines, the memory 147 stores the start pointcoordinates and the size of the region formed by integrating the runs,or run data concerning the run on the second line when the runs on thefirst and second lines are not connected to each other, etc.Accordingly, where the runs are connected to each other, the size, etc.of the integrated region including the connected runs are updated eachtime the line to be processed is shifted from one to another.

The memory 148 stores data on labels obtained by the determination ofthe determination table 145 which is performed on the basis of runsincluded in one image (one page of an image document), i.e. data onrectangles which circumscribe labels each formed of an integrated regionincluding connected runs. If the determination table 145 determines thatthe runs are not connected to each other, it also determines that arun-integrated label has been extracted, and the start point coordinatesand the size of a rectangle which circumscribes the extracted label arestored in the memory 148 in the form of the table shown in FIG. 14.

The run selection signal S38 is used, at the time of updating data to becompared by the comparators 143 a to 143 e and data to be subjected tocalculation using the adder-subtracter 144, to determine which one ofrun data concerning the first line (which is stored in the memory 141and output as the signal S41) and run data concerning the second line(which is indicated by the run expansion signal S2) should be updated.For example, if the run selection signal S38 is “0” (i.e. if thedetermination table 145 determines that the third, the fifth or thesixth determination conditions are satisfied), the run data concerningthe first line (the signal S41) is updated as data to be compared andsubjected to addition/subtraction. If, on the other hand, the runselection signal S38 is “1” (i.e. if the determination table 145determines that the first, the second and the fourth determinationconditions are satisfied), the run data concerning the second line (therun expansion signal S2) is updated as data to be compared and subjectedto addition/subtraction

The selector 142 outputs the run data concerning the first line (thesignal S41) stored in the memory 141 when the selection signal S36 is“1” to indicate that the run connection has been completed, and outputslabel data (the signal S42) supplied from the selector 146 when theselection signal S36 is “0”. In accordance with the output of theselector 142, data in the comparators 143 a to 143 e and in theadder-subtracter 144 are updated.

The above-described processing is repeated till the end of the firstline. When the first line has been all processed, run data concerningthe second line (a signal S47) stored in the memory 147 is stored in thememory 41 via the selector 140. Thereafter, the above-describedprocessing is performed for run data concerning the second line (thesignal S41) and run data concerning a third line (the run expansionsignal S2). Thus, the same processing is repeated till the end of onepage.

As a result of the above-described processing, the memory 148 storesdata on labels extracted from one page of the image document, i.e. dataon rectangles which circumscribe the labels each formed by integratingconnected runs (the start point coordinates and the sizes of therectangles as shown in FIG. 14).

The character direction determination means 125 will now be described.The character direction determination means 125, for each character,separates image data binary-coded by the binary coding means 121corresponding to one of circumscribing rectangles obtained by thecircumscribing-rectangle extraction means 124. The character directiondetermination means 125 compares each of the separated characters and astandard character pattern of a dictionary (not shown) with each otherto determine whether the direction of the character is longitudinal orlateral. The foregoing process is required to be performed for severalcharacters in the circumscribing rectangle. A result of determination ofthe direction of the character performed by the character directiondetermination means 125 is supplied to the image direction determinationmeans 126.

The image direction determination means 126 will now be described. Theimage direction determination means 126 uses the start coordinates andthe size of the circumscribing rectangle obtained by thecircumscribing-rectangle extraction means 124 and a result of thedetermination of the direction of the character supplied from thecharacter direction determination means 125 to determine the directionof the image of the original document.

The image direction determination means 126 comprises, for example, aCPU to determine whether the original document is written longitudinalor lateral and whether the image of the original document faces upwardsor downwards.

Initially, a method of determining whether the original document iswritten longitudinally or laterally in a case where characters in acircumscribing rectangle (a rectangle including characters in one row orone column) are formed longitudinally will now be described. Thedetermination is performed in accordance with the size of acircumscribing rectangle obtained by the circumscribing-rectangleextraction means 124. In a case of an original document writtenlaterally, the size of a circumscribing rectangle, that is, the size ofcharacter rows is in the form elongated laterally and short in thelongitudinal direction. By using the foregoing fact, and assuming thatthe size of each of i circumscribing rectangles having labels 1, 2, 3, .. . , 1 respectively are (x11, y11), (x12, y12), (x13, y13), . . . ,(x1i, y1i), the following calculations are performed:${{xa} = {\sum\limits_{k = 1}^{i}{xlk}}},{/i}$${{ya} = {\sum\limits_{k = 1}^{i}{ylk}}},{/i}$

where xa and ya respectively are average values of lateral sizes andlongitudinal sizes of all of the circumscribing rectangles. If xa≧ya,then a determination is made that the original document is writtenlaterally. In the other cases, the original document is determined to bewritten longitudinally. If the characters in the circumscribingrectangle are formed laterally and xa≧ya, the original document isdetermined to be written longitudinally. In the other cases, theoriginal document is determined to be written laterally.

Then, a method of determining whether the original document facesupwards or downwards will now be described with reference to FIGS. 17and 18.

The determination is performed on the basis of the position of thecircumscribing rectangle. That is, if the characters in thecircumscribing rectangle are formed in the longitudinal direction andthe original document is a lateral original document and the originaldocument faces upwards, then the left ends of the circumscribingrectangles (the character strings) are aligned as shown in FIGS. 17A and17B because the left ends are starts positions for sentences. On theother hand, the right ends are not aligned because the right ends areends of the sentences. By using the above-mentioned characteristic ofthe document, whether the original document faces or downwards can bedetermined. ${xb} = {\sum\limits_{k = 1}^{i}{{xsk}/i}}$${d1} = {\sum\limits_{k = 1}^{i}{\left( {{xsk} - {xb}} \right)/i}}$${d2} = {\sum\limits_{k = 1}^{i}{\left( {{xsk} + {xlk} - {xb}} \right)/i}}$

where xb is an average value of start positions of the circumscribingrectangles and d1 is an average value of errors of the circumscribingrectangles with respect to the average value of the start positions.

On the other hand, d2 is an average value of errors of thecircumscribing rectangles with respect to an average value of the endpositions. In accordance with a result of a comparison between d1 andd2, the direction in which the original document faces can bedetermined. That is, if

d1≧d2,

the direction of the image of the original document is inverted (seeFIGS. 18A and 18B). In the other cases, the direction of the image ofthe original document is determined to be a normal direction (the upwarddirection). The image direction determination means 126 determines thevertical direction of the image on the original document by theforegoing process.

Also in a case where characters in the circumscribing rectangle areformed in the lateral direction and the original document is writtenlongitudinally, the vertical direction of the image of the originaldocument can be determined.

By using the above-mentioned procedure, the direction of the image canbe determined. The copy determining means 161 determines interruption ofcopying of the image in a case where the direction of the image of theprevious page and the direction of the image of the original documentinput at present are different from each other.

A result of the determination performed by the copy determining means161 is supplied to the main CPU 91. The main CPU 91 interrupts thecopying operation. Thus, the display section 82 a displays a messagethat, for example, the direction of the set image has an error to notifythe user the interruption of the operation for copying the image.Moreover, the display section 82 a requires the user to operate the keyto indicate whether or not the user continues the copying operation.

If the user instructs to continue the operation, the copying operationis continued. The copying operation can be interrupted by instructinginterruption. In this case, the user again confirms the direction of theimage of the original document and again sets the original document soas to perform the copying operation.

In another embodiment in which the directions of the original documentsare different from one another, adequate rotation of the images isperformed to correct the directions so as to generate copied images.

The following structure may be employed in a case where the apparatuscomprises the copy determining means 161, the display section 82 a andthe input section 82: if a determination is performed by the copydetermining means 161 that the direction of the image of the previouspage and the direction of the image of the input original document aredifferent from each other, the rotation of the image is performed; amessage whether or not the copying operation is continued is displayedon the display section 82 a; and a determination whether or not thecopying operation is continued is caused to be performed by the user byusing the input section 82.

As described above, the structure comprising the copy determining means161, the display section 82 a and the input section 82 permits a varietyof modifications within the scope of the present invention.

The direction of the image is determined as described above, and imagedata supplied from the image correction section 105 in the scannersection 4 through the image data bus 150 is stored in the buffer memoryregion 98 a of the page memory 98.

The image position determining means 162 determines the position, atwhich the images are formed, in accordance with the method of the copy(for example, two A4-size original document sheets are contracted tocopy the images on one A4-size sheet or four A4-size original documentsheets are contracted to copy the images on one A4-size sheet). That is,the positions, at which images of a plurality of supplied originaldocument sheets are copied, must be changed in accordance withinformation about the direction of the image supplied from the imagedirection detection means 160.

A case will now be considered in which two A4-size original documentsheets are contracted to copy the images on one A4-size originaldocument sheet, as shown in FIGS. 19A to 20B.

If the direction of the original document is longitudinal as shown inFIG. 19A, the positions of the input images of the two original documentsheets in the composite image are as shown in FIG. 19B. That is, the twoinput images are generally located in the lower portion and the upperportion, respectively.

If the direction of the original document is lateral as shown in FIG.20A, the positions of the input images of the two original documentsheets in the composite image are as shown in FIG. 20B. That is, the twoinput images are generally located in the left portion and the rightportion, respectively.

A case will now be considered in which four A4-size original documentsheets are contracted to copy the images on one A4-size originaldocument sheet, as shown in FIGS. 21A to 22B.

In a case where the direction of the image of the original document islongitudinal as shown in FIG. 21A, the positions of the input images ofthe four original document sheets in the composite image are as shown inFIG. 21B. That is, the four input images are generally located at theupper left, upper right, lower left and the lower right positions inthis sequential order.

In a case where the direction of the image of original document islateral as shown in FIG. 22A, the positions of the input images of thefour original document sheets in the composite image are as shown inFIG. 22B. That is, the four input image are generally located at theupper left, upper right, lower left and lower right positions in thissequential order.

In an apparatus having a function capable of recording images on the twosides of sheets in the printer section 6, the direction of recording onthe right side and that on the reverse side of the sheet are differentfrom each other in accordance with the direction of the originaldocument whether the image is formed longitudinally or laterally. In acase where the original document is a longitudinal document, thedirections of images to be recorded on the right side and the reverseside are the same. However, the directions of images to be recorded onthe right side and the reverse side are different from each other in acase of the lateral document. That is, the image is sometimes requiredto be rotated by an angular degree of 180° along the inversion directionof the inversion mechanism section for inverting the recording sheet, onone side of which an image has been recorded. The image positiondetermining means 162 outputs an angle of rotation required in theabove-mentioned case.

The image position determining means 162 for outputting the positions ofimages as described above includes, for example, a CPU which transmitssignals indicating the image positions such that upper left is indicatedby 0, the upper right is indicated by 1, the lower left is indicated by2 and the lower right is indicated by 3 and rotational angles.

The image-size-conversion/image-rotation means 163 contracts/rotateimages in accordance with the method of copying images. In a case where,for example, two A4-size original document sheets are contracted to copyimages on one A4-size original document sheet, the images must berotated by 90° and the reduction by about 71% (a magnification withwhich A4 size is halved) in the lengthwise direction is required. In acase where four A4-size original document sheets are contracted to copyimages on one A4-size original document sheet, rotation of the images isnot required. However, contraction by 50% in the lengthwise direction (amagnification with which A4 is reduced to ¼) must be performed.

If input images are located in a similar sequential order (see FIG. 21B)to that employed when the original document faces side as shown in FIG.24A, composite images are inadequately located as shown in FIG. 24B. Inthis case, the four original document sheets must be located in asequential order as upper right, lower right, upper left and lower left.That is, the configuration must be changed to correspond to thedirection of the original document.

As described above, the image-size-conversion/image-rotation means 163generates the memory address at which the images in the buffer memoryregion 98 a are read in accordance with the method of the copyingoperation and the configuration determined by the image positiondetermining means 162 to correspond to rotation/reduction of the images.Moreover, the image-size-conversion/image-rotation means 163 generatesmemory address for writing read images on the image combining region 98b for developing the images.

The image-size-conversion/image-rotation means 163 is structured asshown in FIG. 23. That is, the image-size-conversion/image-rotationmeans 163 is composed of an address generating means 163 a forgenerating image read address of the buffer memory region 98 a inaccordance with a copying method signal supplied from the main CPU 91; awrite address generating means 163 b for generating the image writeaddress for the image combining region 98 b in accordance with an imagelocating signal supplied from the image position determining means 162;and an image buffer 163 c for adjusting timing of reading/writingimages.

An example of the operation to be performed when A4-size originaldocument sheets are copied by the 4in1 method will now be described.

That is, a user places four sheets of original document D on theoriginal-document tray 8, instructs the 4in1 mode and sheets to whichimages are copied and depresses the print key 81. As a result, a firstsheet of the original document D on the original-document tray 8 isplaced on the original-document retainer 12 by the ADF 7 so that thefirst sheet of the original document D is read by the CCD sensor 34 inthe scanner section 4. 8-bit image data read by the CCD sensor 34 issupplied to the image correction section 105 through the CCD driver 103.After images have been corrected by the image correction section 105,image data is supplied to the image processing section 96 through theimage data bus 150.

In the image processing section 96, a binary coding operation isperformed to covert image data above into 1-bit signals whilemaintaining the gradient and the sharpness of characters by correctingthe ground density of the images, highlighting the edges of the imagesand correcting the recording density characteristic of the printersection 6. Then, image data is supplied to the image direction detectionmeans 160 and the buffer memory region 98 a in the image combinationprocessing section 97 a through the image data bus 150.

Also image data of another original document is supplied to the imagedirection detection means 160 and the buffer memory region 98 a in thebuffer memory region 98 a.

The buffer memory region 98 a is composed of a memory having a capacityof about 8 megabytes and capable of storing images of four A4-sizeoriginal document sheets. Each of the A4-size original document sheetswhich are read sequentially consists of 3307×4677 pixels. Thus, theamount of data after images have been processed by the image processingsection 96 becomes 15,466,839 (=3307×4677) bits. Images, which aresequentially read, are stored in the buffer memory region 98 a of thepage memory 98 shown in FIG. 4 such that the first sheet is stored fromaddress 0, the second sheet is stored from address 15,466,839, the thirdsheet is stored from address 30,933,678 and the fourth sheet is storedfrom address 46,400,517. For example, the first original document hasthe relationship between each pixel of each original document, which hasbeen read, and the address, as shown in FIG. 4. The most upper leftpixel is stored at address 0, the rightmost pixel on the first line isstored at address 3,306, the leftmost pixel on the second line is storedat address 3,307 and the rightmost pixel on the final line is stored ataddress 15,466,838. As for the addresses of the second and followingoriginal documents, the addresses for the second sheet are obtained byadding 15,466,839 to the address of each line for the first sheet, thosefor the third sheet are obtained by adding 30,933,678 to the same, andthose for the fourth sheet are obtained by adding 46,400,517 to thesame, the thus-obtained addresses being then stored in the buffer memoryregion 98 a.

As a result of the above-mentioned operation, four A4-size originaldocument sheets are stored in the buffer memory region 98 a of the pagememory 98.

Then, image data read from the buffer memory region 98 a in accordancewith the configuration of images determined by the image positiondetermining means 162 is combined and stored in the image combiningregion 98 b by using the addresses supplied from theimage-size-conversion/image-rotation means 163.

If all of documents are longitudinal documents, face upwards and writtenlaterally and the sheets are longitudinal sheets, image data of thefirst sheet is stored in the upper left portion of the image combiningregion 98 b of the page memory 98, that of the second sheet is stored inthe upper left portion, that of the third sheet is stored in the lowerleft portion and that of the fourth sheet is stored in the lower rightportion so that a combine image is generated. That is, if longitudinalA4-size original document sheets having all images formed in thelongitudinal as shown in FIG. 21A are copied, the configuration ofimages is determined as shown in FIG. 21B.

As a result, image data items of each document stored in the buffermemory region 98 a of the page memory 98 as shown in FIG. 4 are read ina sequential order as first line (1), second line (2), the third line(3), . . . , the final line (18708). The read image data items are, asshown in FIG. 5, stored in the image combining region 98 b of the pagememory 98.

After the first line of the first sheet has been read, image data in thebuffer memory region 98 a is stored in the image combining region 98 bin the following sequential order: first line of the second sheet, thesecond line of the first sheet, the second line of the second sheet, . .. , the final line of the first sheet, the final line of the secondsheet, the first line of the third sheet, the first line of the fourthsheet, the second line of the third sheet, the second line of the fourthsheet, . . . , the final line of the fourth sheet, and the final line ofthe fourth sheet.

FIG. 5 shows addresses of pixels in the image combining region 98 b. Theleftmost pixel on the first line of the first sheet is stored at address0, the rightmost pixel on the first line of the first sheet is stored ataddress 3,307 and the leftmost pixel on the first line of the thirdsheet is stored at address 30,933,678.

As described above, the page memory control section 97 controlsaddresses to read composite images from the image combining region 98 bin the sequential order indicated by numbers put in parentheses. Readimage data is supplied to the printer section 6 through the image databus 150 so that image data is printed.

As described above, when all of documents are longitudinal documents,face upwards and written laterally and the sheets are longitudinalsheets, image data of the first sheet is stored in the upper leftportion, that of the second sheet is stored in the upper right portion,that of the third sheet is stored in the lower left portion and that ofthe fourth sheet is stored in the lower right portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

When all of documents are longitudinal documents, face downwards andwritten laterally and the sheets are longitudinal sheets, image data ofthe first sheet is stored in the lower right portion of the imagecombining region 98 b of the page memory 98, that of the second sheet isstored in the lower left portion, that of the third sheet is stored inthe upper right portion and that of the fourth sheet is stored in theupper left portion so that a composite image is generated and thecomposite image is printed by the printer section 6.

When all of documents are lateral documents, face upwards and writtenlaterally and the sheets are longitudinal sheets, image data in thebuffer memory region 98 a is rotated by 90° and image data of the firstsheet is stored in the upper right portion of the image combining region98 b of the page memory 98, that of the second sheet is stored in thelower right portion, that of the third sheet is stored in the upper leftportion and that of the fourth sheet is stored in the lower left portionso that a composite image is generated and the composite image isprinted by the printer section 6.

When all of documents are lateral documents, face downwards and writtenlaterally and sheets are longitudinal sheets, image data is rotated by90° and image data of the firs sheet is stored in the lower leftportion, that of the second sheet is stored in the upper left portion,that of the third sheet is stored in the lower right portion and that ofthe fourth sheet is stored in the upper right portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

When all of documents are longitudinal documents, face upwards andwritten longitudinally and sheets are longitudinal sheets, image data ofthe first sheet is stored in the upper right portion of the imagecombining region 98 b of the page memory 98, that of the second sheet isstored in the upper left portion, that of the third sheet is stored inthe lower right portion and that of the fourth sheet is stored in thelower left portion so that a composite image is generated and thecomposite image is printed by the printer section 6.

When all of documents are longitudinal documents, face downwards andwritten longitudinally and sheets are longitudinal sheets, image data ofthe first sheet is stored in the lower left portion of the imagecombining region 98 b of the page memory 98, that of the second sheet isstored in the lower right portion, that of the third sheet is stored inthe upper left portion and that of the fourth sheet is stored in theupper right portion so that a composite image is generated and thecomposite image is printed by the printer section 6.

When all of documents are lateral documents, face upwards and writtenlongitudinally and sheets are longitudinal sheets, image data of thefirst sheet is stored in the lower right portion of the image combiningregion 98 b of the page memory 98, that of the second sheet is stored inthe upper right portion, that of the third sheet is stored in the lowerleft portion and that of the fourth sheet is stored in the upper leftportion so that a composite image is generated and the composite imageis printed by the printer section 6.

When all of documents are lateral documents, face downwards and writtenlongitudinally and sheets are longitudinal sheets, image data of thefirst sheet is stored in the upper left portion of the image combiningregion 98 b of the page memory 98, that of the second sheet is stored inthe lower left portion, that of the third sheet is stored in the upperright portion and that of the fourth sheet is stored in the lower rightportion so that a composite image is generated and the composite imageis printed by the printer section 6.

If lateral documents are mixed with a longitudinal document, mixture ofdocuments is displayed to cause a user to select remaining of theprinting operation, restart or alignment of the documents.

If a printing operation while aligning the direction is selected,corresponding image data is read from the buffer memory region 98 a ofthe page memory 98, and then rotated by 90° and contracted by the imageprocessing section 96 followed by storing the same in the imagecombining region 98 b of the page memory 98. Thus, a composite image isgenerated and the image is printed by the printer section 6.

If original documents facing downwards are mixed, corresponding imagedata is read from the buffer memory region 98 a of the page memory 98,and then rotated by 180° by the image processing section 96 followed bystoring the same in the image combining region 98 b of the page memory98. Thus, a composite image is generated and the image is printed by theprinter section 6.

If the mode is the 2in1 mode, the original document is a longitudinaldocument facing upwards and written laterally and sheets arelongitudinal sheets, image data is rotated by 90°. Then, image data ofthe first sheet is stored in the upper portion of the image combiningregion 98 b of the page memory 98 and that of the second sheet is storedin the lower portion so that a composite image is generated and thecomposite image is printed by the printer section 6.

If the mode is the 2in1 mode, the original document is a longitudinaldocument facing downwards and written laterally and sheets arelongitudinal sheets, image data of the first sheet is stored in thelower portion of the image combining region 98 b of the page memory 98and that of the second sheet is stored in the upper portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

If the mode is the 2in1 mode, the original document is a lateraldocument facing downwards and written laterally and sheets arelongitudinal sheets, image data of the first sheet is stored in theupper portion of the image combining region 98 b of the page memory 98and that of the second sheet is stored in the lower portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

If the mode is the 2in1 mode, the original document is a lateraldocument facing downwards and written laterally and sheets arelongitudinal sheets, image data of the first sheet is stored in thelower portion of the image combining region 98 b of the page memory 98and that of the second sheet is stored in the upper portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

If the mode is the 2in1 mode, the original document is a longitudinaldocument facing upwards and written longitudinally and sheets arelongitudinal sheets, image data of the first sheet is stored in thelower portion of the image combining region 98 b of the page memory 98and that of the second sheet is stored in the upper portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

If the mode is the 2in1 mode, the original document is a longitudinaldocument facing downwards and written longitudinally and sheets arelongitudinal sheets, image data of the first sheet is stored in theupper portion of the image combining region 98 b of the page memory 98and that of the second sheet is stored in the lower portion so that acomposite image is generated and the composite image is printed by theprinter section 6.

If the mode is the 2in1 mode and longitudinal and lateral documents aremixed, mixture of the documents is displayed to urge the user to selectto remain printing, restart or alignment and printing.

If a printing operation while aligning the direction is selected,corresponding image data is read from the buffer memory region 98 a ofthe page memory 98, and then rotated by 90 and contracted by the imageprocessing section 96 followed by storing the same in the imagecombining region 98 b of the page memory 98. Thus, a composite image isgenerated and the image is printed by the printer section 6.

If a downward original document is mixed in the case where the mode isthe 2in1 mode, corresponding image data is read from the buffer memoryregion 98 a of the page memory 98, and then rotated by 180° andcontracted by the image processing section 96 followed by storing thesame in the image combining region 98 b of the page memory 98. Thus, acomposite image is generated and the image is printed by the printersection 6.

A copying operation which is performed when the directions of documentsare different from each other will now be described. A case will now beconsidered in which two A4-size original document sheets are contractedto copy images on one A4-size original document sheet as shown in FIG.25.

If the original documents have different images respectively formed inthe longitudinal direction and the lateral direction as shown in FIGS.25A and 25B, the positions of the two input images are as shown in FIG.25C on a composite image with the conventional structure. That is, whenthe directions of images, which must be combined are different from eachother, original document sheet must contracted and located as shown inFIG. 25D. Specifically, original document A having A4-size is contractedto A5 size (reduction ratio of 71%) and its image is rotated by 90°.original document B having A4-size is contracted to A6 size (reductionratio of 50%) and its image is not rotated.

As described above, the image location determining means 152 comprisesthe CPU to transmit the positions of images to be located, informationabout rotation (indicating whether or not the image is rotated) and thereduction ratio.

The image-size-conversion/image-rotation means 163 contracts/rotates theimage as described above to be adaptable to the image copying method.

In a case shown in FIG. 25, the first sheet of the original document isstored from address 0 in the buffer memory region 98 a, and the secondsheet is stored from address 15,466,839. For example, the first originaldocument has the relationship between each pixel of each originaldocument, which has been read, and the address, as shown in FIG. 26. Themost upper left pixel is stored at address 0, the rightmost pixel on thefirst line is stored at address 4676, the leftmost pixel on the secondline is stored at address 4677 and the rightmost pixel on the final lineis stored at address 15,466,838. As for the addresses of the secondoriginal document, the addresses for the second sheet are obtained by2in1 adding 15,466,839 to the address of each line for the first sheet,the thus-obtained addresses being stored in the buffer memory region 98a.

As a result of the above-mentioned operation, four A4-size originaldocument sheets are stored in the buffer memory region 98 a of the pagememory 98.

Then, image data read from the buffer memory region 98 a in accordancewith the configuration of images determined by the image positiondetermining means 162 is combined and stored in the image combiningregion 98 b by using the addresses supplied from theimage-size-conversion/image-rotation means 163.

If the directions of the original documents are mixed as shown in FIGS.25A and 25B, the copied image is as shown in FIG. 25D such that thecopied image has a size of longitudinal A4-size and formed images havedifferent sizes but formed in the same direction.

As a result, image data items of each document stored in the buffermemory region 98 a shown in FIG. 26 are read in a sequential order asfirst line (1), the second line (2), the third line (3), . . . , thefinal line (6614), as shown in FIG. 26. The read image data items arestored in the image combining region 98 b, as shown in FIG. 27. Therelationship of the memory addresses to be stored will now be described.To simplify the description, the sheet to be output (to be printed) ismade to be a longitudinal A4-size sheet.

Initially, the first line (1), the second line (2), . . . , of the firstoriginal document sheet are sequentially read and contracted to 71%. Thecontracted lines are sequentially stored at memory positions (1), (2), .. . , (addresses respectively start at 0, 3307 and 6614) shown in FIG.27. As for the second original document, lines at (3308), (3309), . . ., stored in the buffer memory region 98 a are sequentially read andrespectively contracted to 50%. The contracted lines are sequentiallystored at the memory positions (3308), (3309), . . . , shown in FIG. 27.

A process to be performed when the vertical directions of two A4-sizeoriginal document sheets are different from each other as shown in FIG.28 and they are contracted and copied to one A4-size original documentsheet will now be described.

If the vertical directions of the original documents are different asshown in FIGS. 28A and 28B, configuration is made as shown in FIG. 28Cby the conventional method without consideration of the direction. Ifthe vertical direction of the images to be combined are mixed, the imagemust be rotated so as to be located as shown in FIG. 28D. That is,original document B must be rotated by 180° before it is located.

Images are stored at the addresses of the buffer memory region 98 ashown in FIG. 29. The images are stored at positions in the imagecombining region 98 b shown in FIG. 30. That is, lines of the secondoriginal document stored at (3307), (3308), . . . , in the buffer memoryregion 98 a are sequentially read and respectively are contracted to71%. The contracted lines are sequentially stored at the memorypositions (3308), (3309), , shown in FIG. 30.

A process which is performed when an original document having an imageon one side thereof is copied to two sides of a sheet will now bedescribed.

If two longitudinal original document sheets are copied on the two sidesof a sheet as shown in FIG. 31A, the images must be located as shown inFIG. 31C. In a case of lateral original documents as shown in FIG. 31Bare copied, located images are turned up side down as shown in FIG. 31Dif the same configuration (see FIG. 31C) as that employed in the case ofthe longitudinal original document. That is, the adequate imagedirection is different between the longitudinal original document andthe lateral original document when the images are copied on the twosides. Specifically, in the case of the lateral original document,either of the first sheet or the second sheet must be rotated by 180°.

As for the specific memory configuration in the page memory 98, lines ofthe second original document sheet stored at (3308), (3309), . . . , ofthe buffer memory region 98 a are sequentially read and respectivelycontracted to 71%. Reduced lines are stored at the memory positions(3308), (3309) in the image combining region 98 b, as shown in FIG. 32.

A case where an original document sheet, on the two sides of whichimages are formed, is contracted and output on either side of one sheet(2in1) will now be considered. When an original document having imageson the two side thereof as shown in FIG. 33 is output, located imagesare turned upside down as shown in FIG. 34A if the images are notlocated adequately. In this case, the directions of images on the twosides of the input original document must be determined to adequatelylocate images, as shown in FIG. 34B.

A process will now be described in which original documents each havingimages on the two sides are copied by a Ninl method. A case will now bedescribed in which original documents each having images on the twosides thereof and original documents each having an image on one sidethereof are copied.

When there original document sheets shown in FIG. 35 are output by the4in1 method, images are located as shown in FIGS. 36A and 36B if theimages are located similarly to the case of the original document havingimages on the two sides thereof because the first original document hasimages on the two sides thereof and each of the second and thirdoriginal documents has an image on one side thereof. Although the outputcan be made on one sheet as shown in FIG. 36C, images are output on twosheets and positions of D, B and F shown in FIG. 36A are made to beblank portions. That is, a determination whether the read originaldocument is an original document having images on the two sides thereofor an original document having an image on one side thereof must beperformed and copy of the reverse side (white paper) of the originaldocument having an image on one side thereof must be inhibited.

FIG. 37 shows an example of the structure of a white paper determinationmeans for determining whether or not the read image is a white paper.The operation will now be described.

The white paper determination means is composed of a binary-coding means202, a black-pixel determination means 204 and a determination means206. Image data (f) read by the scanner section 4 is supplied to thebinary-coding means 202 so that it is binary-coded under the followingconditions. Thus, binary-coded signal (g) is transmitted.

g=0:f<Th0

g=1:f≧Th0

where the case where g=1 means that the subject pixel is a black pixel.

FIG. 38 is a circuit diagram of the binary-coding means 202. Theblack-pixel count means 204 counts the number of black pixels inresponse to the binary-coded signal (g). The black-pixel count means 204comprises an adder as shown in FIG. 39 to add the binary-coded signals(g) so as to transmit a count signal (h).

The determination means 206 is formed into a threshold value processingcircuit as shown in FIG. 40 to subject the count signal (h) andthreshold value Th1 to perform the following determination:

White Paper: h<Th1

Non-White Paper: h≧Th1

Thus, whether the read original document is an original document havingimages on the two sides thereof or an original document having an imageon one side thereof can be determined.

Although the process for copying an original document having an image onone side thereof is copied to the two sides of a sheet has beendescribed, a stapling position causes the adequate image location to bedifferent when stapling process is performed in which a plurality ofcopied sheets are stapled.

When two original document sheets as shown in FIG. 41 are copied to thetwo sides of a sheet, the vertical configuration of images becomesdifferent between a case where the upper left portion is stapled asshown in FIG. 42 and a case where the upper left portion is stapled asshown in FIG. 43. The stapling position must be previously instructedand the direction of the original document must be determined to beadaptable to the instructed position so as to adequately locate theimages.

As described above, when the function of contracting a plurality oforiginal document sheets to combine and output the images onto one sheetor a double-side output function is used by the conventional copyingmachine, a required copy cannot be obtained in many cases attributableto the direction of the original document whether the image is formed inthe longitudinal direction or the lateral direction and the direction ofthe paper sheet cassette. Erroneous use of the above-mentioned functionprovided for the purpose of improving the appearance of the copy andreducing the quantity of copying sheets raises a problem ofinconvenience for a user or increase in the quantity of paperattributable to the required re-copying operation. However, the presentinvention enables an image processing apparatus to be provided which iscapable of forming a required copy regardless of the direction of theoriginal document set by a user and the direction of the set originaldocument.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

What is claimed is:
 1. An image forming apparatus comprising: anoriginal-document retainer; first detecting means for detecting anorientation and a size of an original document placed on theoriginal-document retainer; reading means for reading the originaldocument and providing an original image; second detecting means fordetecting an orientation and arranging direction of strings ofcharacters on the original document on the basis of the original imageread by the reading means; image orientation detecting means fordetecting whether the original image is in a landscape orientation or ina portrait orientation on the basis of the orientation and size of theoriginal document detected by the first detecting means and theorientation and arranging direction of the characters detected by thesecond detecting means; inputting means for inputting a size and anorientation of an image forming medium; and arrangement determiningmeans for, when a plurality of original images are reduced in size to beprinted on one image forming medium whose size and orientation are inputby the inputting means, determining an arrangement, orientation andreduction ratio of each of the original images on the basis of anorientation of each of the original images detected by the imageorientation detecting means and the size and orientation of the imageforming medium input by the inputting means, wherein the arrangementdetermining means includes means for rotating and reducing the size ofeach of the original images differently when the orientations of aplurality of original images include both landscape orientation andportrait orientation.
 2. An apparatus according to claim 1, furthercomprising blank-paper determining means for determining whether theoriginal images provided by the reading means are blank.
 3. An apparatusaccording to claim 2, wherein the reading means includes means forreading both sides of the original document to provide original images;and the arrangement determining means including means for preventing animage from being formed on the image forming medium when the image hasbeen determined to be blank by the blank-paper determining means.
 4. Anapparatus according to claim 1, wherein the arrangement determiningmeans includes means for rotating one of the original images by 90°,when the original images are two in number, and the orientations of theoriginal images are different from each other by 90°.
 5. An apparatusaccording to claim 1, wherein the arrangement determining means includesmeans for rotating one of the original images by 180°, when the originalimages are two in number, and the orientations of the original imagesare different from each other by 180°.